package com.doyens.seckill.controller;

import com.doyens.seckill.pojo.SeckillGoods;
import com.doyens.seckill.service.SeckillGoodsService;
import com.doyens.seckill.utils.DateUtil;
import com.netflix.loadbalancer.PingUrl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/seckill/goods")
public class SeckillGoodsController {

    @Autowired
    private SeckillGoodsService seckillGoodsService;

    @GetMapping("/menus")
    public List<Date> loadMenus(){
        return DateUtil.getDateMenus();
    }

    @GetMapping("/list")
    public List<SeckillGoods> list(String key){
        return  seckillGoodsService.list(key);
    }

    //查看商品详情
    @GetMapping("/one")
    public SeckillGoods one(String time,Long id){
        return seckillGoodsService.queryById(time,id);
    }

}
